<?php get_instance()->load->model('petitions/vote');  ?>


<h3 class='lead'>Recently supported</h3>
<hr>
<br>
<ul id='list-votes'>
   	<?= get_instance()->vote->getLastVotes(); ?>
</ul>






<script>
$(document).ready(function(){
	//check();
	
});

function check(){
	console.log(document.getElementById('list-votes').firstChild.nextSibling.firstChild.nextSibling);
	var last = document.getElementById('list-votes').firstChild.nextSibling.firstChild.nextSibling.value;

	var ajax = $.ajax({
		  url: "/fetch/newvotes",
		  type: 'POST',
		  dataType: "html",
		  data:{ 'last': last},		  
		})
	ajax.done(function(msg, e){
			 console.log((msg) );
		  	 check(); 	
	})
}


</script>